﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;

namespace PTCScheduler
{
    /// <summary>
    /// Class to implement the printing feature of datagrids.
    /// </summary>
    class PrintDataGrid
    {
        //Object variable to hold instance of PrintDialog.
        private PrintDialog dlgPrint;

        //Constructor that takes in a datagrid as argument.
        public PrintDataGrid(System.Windows.Controls.DataGrid dataGrid)
        {
            //Print the datagrid using print method and pass dataGrid through.
            print(dataGrid);
        }

        //Method to handle the printing of datagrid.
        public void print(System.Windows.Controls.DataGrid dataGrid)
        {
            //Create new instance of the PrintDialog object.
            dlgPrint = new PrintDialog();
            
            //Print the datagrid visual control.
            dlgPrint.PrintVisual(dataGrid, "Data Grid Document");
        }
    }
}
